function AjaxFormSubmit (id,url) {
    if(!id) {
        id = 'form';
    }
    if(!url) {
        url = window.location.href;
    }
    $('#'+id).ajaxSubmit(function(res){
        if(res.code==1) {
            layer.msg(res.msg,function(){
                if(res.url) {
                    location.href = res.url;
                }
            });
        }else{
            layer.open({
                content:res.msg,
                yes:function(){
                    layer.closeAll();
                    if(res.url) {
                        location.href = res.url;
                    }
                }
            })
        }
    });
}

function PageFormSubmit (id,url) {
    if(!id) {
        id = 'form';
    }
    if(!url) {
        url = window.location.href;
    }
    $('#'+id).ajaxSubmit(function(res){
        if(res.code==1) {
            layer.msg(res.msg,function(){
            });
        }else{
            layer.open({
                content:res.msg,
                yes:function(){
                    layer.closeAll();
                    parent.location.reload();
                }
            })
        }
    });
}
